<?php

namespace App\Http\Controllers\Laravel\Carbon;

use App\BCAM\CMVariable\CMVariable;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
//Laravle时区要在app里面设置
class LabController extends Controller
{
    //
    public function differentialTime(){
        //differential time

        /*$carbon = Carbon::now('Asia/Shanghai');
        CMVariable::compareRes($carbon,$carbon->toDay(),$carbon->hour);
        print $carbon ."<br>";
        print $carbon->toDay();*/
        $time = date('Y-m-d');
        $diff = strtotime($time.' 07:00:00') - strtotime(date('Y-m-d H:i:s'));
        $diff = strtotime($time.' 07:00:00') - strtotime('2017-09-21 00:15:00');
        //$diff = strtotime($time.' 07:00:00') - time();
        CMVariable::compareRes($diff,strtotime(date('Y-m-d H:i:s')),date('Y-m-d H:i:s'),strtotime($time.' 07:00:00'));
        if($diff <= 0){
            //立即发送
            echo '立即发送';
        }else{
            echo '延迟'.$diff.'发送';
        }
        /*if(time() === strtotime(date('Y-m-d H:i:s'))){
            echo '相等';
        }*/
    }

    //
}
